export default class Http {
	static request({
		method = 'GET',
		url = '',
		data = {}
	}) { // statusCode
		return new Promise((resolve, reject) => {
			uni.request({
				method,
				url: 'http://192.168.1.227' + url,
				data
			}).then(response => {
				// console.log(response)
				let [err, res] = response
				console.log(res)
				if (res.statusCode === 200) {
					resolve(res.data.data)
				} else {
					uni.showToast({
					    title: res.errMsg,
					    duration: 2000,
						icon: 'none'
					})
					reject(res.message)
				}
			})
		})
	}
}
